
<template>
  <div>
      <div
        v-if="!menu"
        class="avue-sidebar--tip">没有发现工序</div>
      <el-menu
        v-if="menu"
        :show-timeout="200"
        unique-opened
        mode="vertical">
        <sidebar-item
          :menu="menuTree"
          :props="menu.props"
          first />
      </el-menu>
  </div>
</template>

<script>
import sidebarItem from './process-menu-sidebar'
import {fetchMenuTree} from "@/api/pfoc/pfocprocess";
export default {
  name: 'processMenu',
  components: { sidebarItem},
  computed: {

  },
  data() {
    return {
      // 配置工序菜单的属性
      menu: {
        props: {
          id: 'id',
          label: 'label',
          workshopSection: 'workshopSection',
          children: 'children'
        }
      },
      //获取工序树形数据
      menuTree: [],
      // 查询参数
      queryParams: {
        parentId: undefined,
        workshopSection:null,
        processName: null,
      }
    }
  },
  created() {
    //获取工序树形数据
    this.getMenuTree()
  },
  methods: {
    getMenuTree() {
      this.loading = true
      fetchMenuTree(this.queryParams).then(response => {
        this.menuTree = response.data.data
      })
    },
  }
}
</script>


